package com.gupao.gupaoeduvippattern.pattern.observer.gper;

import java.util.Observable;
import java.util.Observer;

/**
 * 观察者对象。当被观察者信息发生改变时，都会推送消息给它。也就是调用其update方法
 *
 * @author 大帅
 * @description
 * @date 2020-12-02
 */
public class Teacher implements Observer {

    /** 老师的姓名 */
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Teacher(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        GPer gPer = (GPer) o;
        Question question = (Question) arg;

        System.out.println("===================");
        System.out.println(name + "：你好 \n您收到一个来自的"+gPer.getName()+"的"+question.getUserName()+"提问，请您解答，问题内容如下：\n"+question.getContent());
    }
}
